package com.wll.study.algotiyhm.about_sort;

/**
 * 关于冒泡排序
 */
public class BubbleSort {
    /**
     * 冒泡排序实现由小到大排序
     * @param arr
     * @return
     */
    public static int[] bubbleSort(int[] arr){
        for (int i = 0; i < arr.length; i++) {
            for (int j = i+1; j < arr.length-i; j++) {
                if (arr[i]>arr[j]){
                    int temp = arr[i];
                    arr[i] = arr[j];
                    arr[j] = temp;
                }
            }
        }
        return arr;
    }
}
